package com.polukeuro.app.controllers;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.polukeuro.app.model.action.Pronostic;
import com.polukeuro.app.model.dao.AbstractDAO;

@Controller
@RequestMapping("/persist")
public class PersistController {

	
	@RequestMapping(method=RequestMethod.GET,value="pronostic/{id}.json", headers="Accept=application/json")
	public @ResponseBody Pronostic getPronostic(@PathVariable String id){
		Pronostic p = new Pronostic();
		p.setId(Integer.parseInt(id));
		p.setName("mon premier pronostic");
		
		AbstractDAO dao = new AbstractDAO();
		dao.persist(p);
		
		return p;
	}
//	
//	@RequestMapping(method=RequestMethod.POST,value="setPronostic.json", headers="Accept=application/json")
//	public @ResponseBody boolean setPronostic(@PathVariable){
//		return false;
//	}
//	
}
